const arr = [null, null, undefined, undefined, NaN, NaN, Infinity, Infinity, {}, {}, [1], [1], function() { }, function() { },
];

function unique(array) {
  for (let i = 0; i < array.length; i++) {
    for (let j = i + 1; j < arr.length; j++) {
      if (Object.is(arr[i], arr[j])) {
        arr.splice(j, 1);
        j--;
      }
    }
  }
  return arr;
}

console.log(unique(arr));